//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace OpenLS.UI.Interop
{
    [ComImport, CoClass(typeof (FileOpenDialogImp)), Guid("d57c7288-d4ad-4768-be02-9d969532d960"),
     InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    internal interface IFileOpenDialog
    {
        [PreserveSig]
        int Show(IntPtr parent);

       // void SetFileTypes(int cFileTypes, ref NativeMethods.COMDLG_FILTERSPECUnsafe rgFilterSpec);
        void SetFileTypes(int cFileTypes, [MarshalAs(UnmanagedType.LPArray)]string[] rgFilterSpec);

        void SetFileTypeIndex(int iFileType);

        void GetFileTypeIndex(out int piFileType);

        void Advise([MarshalAs(UnmanagedType.Interface)] IFileDialogEvents pfde, out uint pdwCookie);

        void Unadvise(uint dwCookie);

        void SetOptions(NativeMethods.FOS fos);

        void GetOptions(out NativeMethods.FOS pfos);

        void SetDefaultFolder([MarshalAs(UnmanagedType.Interface)] IShellItem psi);

        void SetFolder([MarshalAs(UnmanagedType.Interface)] IShellItem psi);

        void GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);

        void GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);

        void SetFileName([MarshalAs(UnmanagedType.LPWStr)] string pszName);

        void GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);

        void SetTitle([MarshalAs(UnmanagedType.LPWStr)] string pszTitle);

        void SetOkButtonLabel([MarshalAs(UnmanagedType.LPWStr)] string pszText);

        void SetFileNameLabel([MarshalAs(UnmanagedType.LPWStr)] string pszLabel);

        void GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);

        void AddPlace([MarshalAs(UnmanagedType.Interface)] IShellItem psi, NativeMethods.FDAP fdap);

        void SetDefaultExtension([MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension);

        void Close([MarshalAs(UnmanagedType.Error)] int hr);

        void SetClientGuid(ref Guid guid);

        void ClearClientData();

        void SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);

        void GetResults([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppenum);

        void GetSelectedItems([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppsai);
    }

    [ComImport, ClassInterface(ClassInterfaceType.None), Guid("DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7")]
    internal class FileOpenDialogImp
    {
    }
}